package com.sq.partner.manager.service;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import com.sq.partner.manager.common.Result;
import com.sq.partner.manager.mybatis.model.CoreDept;
import com.sq.partner.manager.mybatis.model.GatewayChannelInfo;
import com.sq.partner.manager.mybatis.model.GatewayPolicy;
import com.sq.partner.manager.mybatis.model.TreeDto;
import com.sq.partner.manager.util.Page;

public interface IGatewayLifePolicyListService {

	/**
	 * 查询传入机构集合及其子机构
	 * @param deptStr
	 * @return
	 * @throws Exception
	 */
	public List<CoreDept> queryPrivilegeBranch(String deptCodeStr) throws Exception; 
	
	/**
	 * 根据出单机构dept属性及parentDeptCode查询出单机构及其子机构
	 * @param page
	 * @param parentDeptCode
	 * @return
	 * @throws Exception
	 */
	public Page<CoreDept> queryDeptPageByDeptAndParentDeptCode(Page<CoreDept> page ,String parentDeptCode) throws Exception;
	
	/**
	 * 查询人险相关合作伙伴
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public Page<GatewayChannelInfo> queryChannelInfoPageOfLife(Page<GatewayChannelInfo> page)throws Exception;

	public List<Map> queryChannelInfoListOfLife(GatewayChannelInfo channelInfo,String flag)throws Exception;

	public List<Map> queryChannelInfoList(GatewayChannelInfo channelInfo,String flag)throws Exception;
	
	/**
	 * 查询传入的合作伙伴的合作伙伴子机构
	 * @param parentChannelCode
	 * @return
	 * @throws Exception
	 */
	public List<TreeDto> querySubChannelTreeByParentChannelCode(String parentChannelCode) throws Exception;
	
	/**
	 * 分页条件查询人险保单信息
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public Page queryLifePolicyPageByCriteria(Page page) throws Exception;
	
	/**
	 * 条件查询人险保单信息
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public List<Map<String,Object>> queryLifePolicyListByCriteria(Map<String,Object> map) throws Exception;
	
	/**
	 * 人险保单信息导出
	 * @param lifePolicyList
	 * @throws Exception
	 */
	public void downloadLifePolicyFile(List<Map<String,Object>> lifePolicyList,HttpServletResponse response) throws Exception;
	
	public GatewayPolicy queryPolicyInfoByPolNo(String polNo) throws Exception;
	
	public void downloadLifeTeamPolicyBBRInfoList(String polNo,HttpServletResponse response) throws Exception;

	public Page queryLifePolicyEinvoiceInfoByPage(Page page) throws SQLException;

	List<Map<String, Object>> queryLifePolicyEinvoiceListByCriteria(
			Map<String, Object> map) throws Exception;

	/**
	 * 展示汇总数据
	 * @param map
	 * @return
	 * @throws SQLException
	 */
    List<Map<String, String>> queryLifePolicyAll(Map<String, String> map) throws Exception;
    
    /**
     * 导出Excel
     * @param lifePolicyList
     * @param response
     * @throws Exception
     */
    void downloadLifeFacadePolicyFileByCriteria(List<Map<String, Object>> lifePolicyList, HttpServletResponse response)
            throws Exception;
    /**
     * 导出Excel 界面出单
     */
    List<Map<String, Object>> queryLifeFacadePolicyListByCriteria(Map<String, Object> map) throws Exception;
    /**
     * 导出Excel
     */
    void downloadLifePolicyFile1(List<Map<String, Object>> lifePolicyList, HttpServletResponse response)
            throws Exception;

	public Result addEmailReSend(String polNo, String email) throws Exception;

	public Result addSMSReSend(String polNo, String phoneNo) throws Exception;
	
	/**
	 * @since	2022年4月8日
	 * @see	单条批单查询（最新的）
	 * 		SELECT * from 
       			(SELECT ROWNUM r , e.* from t_gateway_endorse e WHERE e.policy_no ORDER BY e.valid_date DESC ) temp
    		WHERE r = 1
	 * @param polno
	 * @return
	 * @throws Exception
	 */
	public String querySingleEndorseByPolno(String polno) throws Exception;

}
